<template>
	<scroll-view scroll-y="true" scroll-with-animation :style="{ height: scrollViewHeight + 'px'}" @scroll="scroll" >
		
		<view class="videoZone">
				<view class="header">
					<view class="iconImg">
						<image src="../../static/images/icon_home_dytj.png" mode=""></image>
						<text>{{ classifyList[classify].item1 }}</text>
					</view>
				</view>
				
				<view class="videoItem">
					<view class="item" v-for="(item, index) in videoData.item1" :key="index" @click="videoDataCilic(item)">
						<view class="img">
							<image :src="item.vod_pic" mode=""></image>
							<text>{{ item.vod_remarks }}</text>
						</view>
						<view class="txt">
							<text class="title">{{ item.vod_name }}</text>
							<text class="content">{{ item.vod_blurb }}</text>
						</view>
					</view>
				</view>

		</view>
		
		<view class="videoZone">
				<view class="header">
					<view class="iconImg">
						<image src="../../static/images/icon_home_dytj.png" mode=""></image>
						<text>{{ classifyList[classify].item2 }}</text>
					</view>
				</view>
				
				<view class="videoItem">
					<view class="item" v-for="(item, index) in videoData.item2" :key="index" @click="videoDataCilic(item)">
						<view class="img">
							<image :src="item.vod_pic" mode=""></image>
							<text>{{ item.vod_remarks }}</text>
						</view>
						<view class="txt">
							<text class="title">{{ item.vod_name }}</text>
							<text class="content">{{ item.vod_blurb }}</text>
						</view>
					</view>
				</view>
		
		</view>
		
		<view class="videoZone">
				<view class="header">
					<view class="iconImg">
						<image src="../../static/images/icon_home_dytj.png" mode=""></image>
						<text>{{ classifyList[classify].item3 }}</text>
					</view>
				</view>
				
				<view class="videoItem">
					<view class="item" v-for="(item, index) in videoData.item3" :key="index" @click="videoDataCilic(item)">
						<view class="img">
							<image :src="item.vod_pic" mode=""></image>
							<text>{{ item.vod_remarks }}</text>
						</view>
						<view class="txt">
							<text class="title">{{ item.vod_name }}</text>
							<text class="content">{{ item.vod_blurb }}</text>
						</view>
					</view>
				</view>
		
		</view>
		
		<view class="videoZone">
				<view class="header">
					<view class="iconImg">
						<image src="../../static/images/icon_home_dytj.png" mode=""></image>
						<text>{{ classifyList[classify].item4 }}</text>
					</view>
				</view>
				
				<view class="videoItem">
					<view class="item" v-for="(item, index) in videoData.item4" :key="index" @click="videoDataCilic(item)">
						<view class="img">
							<image :src="item.vod_pic" mode=""></image>
							<text>{{ item.vod_remarks }}</text>
						</view>
						<view class="txt">
							<text class="title">{{ item.vod_name }}</text>
							<text class="content">{{ item.vod_blurb }}</text>
						</view>
					</view>
				</view>
		
		</view>
	</scroll-view>
</template>

<script>
	export default {
		props: {
			videoData: {
				type: Object
			},
			scrollViewHeight: {
				type: Number
			},
			classify: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				isTip: true,
				classifyList: [
					{ item1: '电影', item2: '连续剧', item3: '动漫', item4: '综艺'},
					{ item1: '科幻片', item2: '动作片', item3: '动画片', item4: '爱情片'},
					{ item1: '国产剧', item2: '港台剧', item3: '日韩剧', item4: '欧美剧'},
					{ item1: '科幻', item2: '国产', item3: '青春', item4: '欧美剧'},
				]
			};
		},
		methods: {
			scroll({ detail }) {
				if (this.scrollViewHeight > detail.scrollTop) {
					this.isTip = true
				}
				if (detail.scrollTop >= this.scrollViewHeight && this.isTip) {
					this.isTip = false
					// uni.showToast({
					// 	title: '双击顶部栏回到',
					// 	icon: 'error'
					// })
				}
			},
			videoDataCilic(data) {
				this.$emit('videoDataClick', data)
			}
		}
	}
</script>

<style lang="scss" scoped>
	scroll-view {
		position: relative;
		width: 100%;
		height: 100%;
	}
	.swiper {
		width: 100%;
		height: 300rpx;
		background-color: #f7f8fa;
		
		swiper-item {
			width: 100%;
			height: 100%;
			
			image {
				width: 100%;
				height: 100%;
			}
		}
	}
	
	.videoZone {
		width: 100%;
		padding: 10rpx;
		box-sizing: border-box;
		.header {
			width: 100%;
			height: 50rpx;
			
			.iconImg {
				display: flex;
				align-items: center;
				width: 100%;
				height: 100%;
				box-sizing: border-box;
				background-color: #fff;
				image {
					width: 32rpx;
					height: 32rpx;
					margin-right: 5rpx;
					margin-left: 5rpx;
				}
				
				text {
					font-size: 14px;
				}
			}
		}
		
		.videoItem {
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			.item {
				flex: 30%;
				display: flex;
				flex-direction: column;
				height: 350rpx;
				margin: 10rpx;
				border-radius: 10rpx;
				box-sizing: border-box;
				.img {
					
					position: relative;
					width: 100%;
					height: 290rpx;
					image {
						width: 100%;
						height: 100%;
						border-radius: 10rpx;
					}
					
					text {
						position: absolute;
						bottom: 0;
						left: 0;
						width: 100%;
						height: 40rpx;
						line-height: 40rpx;
						text-align: center;
						border-bottom-left-radius: 10rpx;
						border-bottom-right-radius: 10rpx;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 1;
						overflow: hidden;
						background-color: rgba(0,0,0,.3);
						font-size: 12px;
						color: #fff;
					}
				}
				.txt {
					display: flex;
					flex-direction: column;
					width: 100%;
					height: 60rpx;
					margin-top: 5rpx;
					font-size: 12px;
					overflow: hidden;
					.title {
						font-weight: bold;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 1;
						overflow: hidden;
						
					}
					
					.content {
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 1;
						overflow: hidden;
						color: #ccc
					}
				}
				
			}
		}
	}
	
	
</style>
